package ord2.impl.converter;

import java.io.File;
import ord2.convert.ConvertException;
import ord2.convert.Converter;

/**
 * Implementação de um conversor de PDF para TXT
 *
 * @author José Ivan
 * @author Edviges
 */
public final class PdfConverter implements Converter {

    @Override
    public void convert(File in, File out) throws ConvertException {
        
        try {
    
            org.apache.pdfbox.ExtractText.main(
                        new String[] {
                            in.getAbsolutePath(),
                            out.getAbsolutePath()
                        }
                    );
        } catch (Exception ex) {

            throw new ConvertException("Conversion not possible","pdftotxt");
        }
    }

    @Override
    public void convert(byte[] in, byte[] out) throws ConvertException {
        
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
